const schedule = require('node-schedule');
const ws = require('../websocket');
//每天00:00点关闭作业箱
// schedule.scheduleJob('0 00 0 * * *',  function () {
// });


// var rule = new schedule.RecurrenceRule();
// rule.minute = [0,10,20,30,40,50];
// //每隔5分钟
// schedule.scheduleJob(rule,  async function () {
//     const result = await viewSettingService.view_work();
//     if(result) {
//         console.log(result)
//     }
// });

//每隔一分钟发送一次websocket请求
schedule.scheduleJob('0 * * * * *',  function () {
    console.log('websocket')
    const data= {"cmd":"client","status":"heartbeat","lockerid":"home",}
    ws.send(JSON.stringify(data));
});

